#include "task.h"
#include <string>

Task::Task(std::string text)
{
  this->text = text;
  this->next = nullptr;
  this->prev = nullptr;
  this->child_head = nullptr;
  this->child_tail = nullptr;
  this->status = Todo;
}

std::string enumToString(TaskStatus status)
{
  if (status == Todo)
  {
    return "Todo";
  }
  else if (status == Done)
  {
    return "Done";
  }
  else
  {
    return "Abandon";
  }
}

std::string Task::get_text()
{
  return this->text;
}

void Task::set_text(std::string text)
{
  this->text = text;
}

std::string Task::get_status()
{
  return enumToString(this->status);
}

void Task::change_status()
{
  if (this->status == Todo)
  {
    this->status = Done;
  }
  else if (this->status == Done)
  {
    this->status = Abandon;
  }
  else
  {
    this->status = Todo;
  }
}

Task *Task::get_parent()
{
  return this->parent;
}

void Task::set_parent(Task *parent)
{
  this->parent = parent;
}

Task *Task::get_next()
{
  return this->next;
}

void Task::set_next(Task *next)
{
  this->next = next;
}

Task *Task::get_prev()
{
  return this->prev;
}

void Task::set_prev(Task *prev)
{
  this->prev = prev;
}

Task *Task::get_child_head()
{
  return this->child_head;
}

void Task::set_child_head(Task *child_head)
{
  this->child_head = child_head;
}

Task *Task::get_child_tail()
{
  return this->child_tail;
}

void Task::set_child_tail(Task *child_tail)
{
  this->child_tail = child_tail;
}